//
//  DYADWebVC.m
//  TerritoryShopkeeper
//
//  Created by 黄德玉 on 2018/6/30.
//  Copyright © 2018年 ZDQK. All rights reserved.
//

#import "DYADWebVC.h"
#import <WebKit/WebKit.h>
#import <Masonry/Masonry.h>


@interface DYADWebVC ()

@property (nonatomic,strong) WKWebView * webView;
@property (nonatomic,strong) WKUserContentController * contentController;


@end

@implementation DYADWebVC
- (void)viewDidLoad {
    [super viewDidLoad];
    [self.view addSubview:self.webView];
    [self.webView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.equalTo(self.view);
    }];
    [self.webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:self.urlStr]]];
}


- (WKWebView *)webView{
    if (!_webView) {
        WKWebViewConfiguration *config = [WKWebViewConfiguration new];
        self.contentController = [[WKUserContentController alloc] init];
        config.userContentController = self.contentController;
        config.preferences = [WKPreferences new];
        config.preferences.minimumFontSize = 10;
        config.preferences.javaScriptEnabled = YES;
        config.preferences.javaScriptCanOpenWindowsAutomatically = NO;
        _webView = [[WKWebView alloc] initWithFrame:self.view.bounds configuration:config];
        _webView.allowsBackForwardNavigationGestures = YES;
        _webView.scrollView.maximumZoomScale = 1.0;
        _webView.scrollView.minimumZoomScale   = 1.0;
        _webView.scrollView.showsHorizontalScrollIndicator = NO;
        _webView.scrollView.showsVerticalScrollIndicator = NO;
    }
    return _webView;
}



@end
